UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S6rRnlG4IVYjhj6k4q8J/9uETcVp0B0TVu4RGrLm9RQ=' 
WHERE 
  key_id = '7e62cd3a55771616f618bfd7508ce44bf6f466b75569ec9ab51eac324f3846a7' 
  AND (
    token = 'S6rRnlG4IVYjhj6k4q8J/9uETcVp0B0TVu4RGrLm9RQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037