UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lsv6+3XJLXqo18UwITZ74DQ6sqCqdF0W93JL3Vyv8Eo=' 
WHERE 
  key_id = 'e92e7de97bf101450fc1ab0b4f751edf690b8683a164e3627d2ae6c71e8a1bb3' 
  AND (
    token = 'Lsv6+3XJLXqo18UwITZ74DQ6sqCqdF0W93JL3Vyv8Eo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038