UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JPg+XJliHA2TlLIRyZ9OuH1BdZPGWSKQDepOPX+wEUo=' 
WHERE 
  key_id = 'cbf40f95c968b5b210a5fedc1bc44a157b040079d853ef9634abb9153b96a3b6' 
  AND (
    token = 'JPg+XJliHA2TlLIRyZ9OuH1BdZPGWSKQDepOPX+wEUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030