UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KTLFJMnMuWmUWLDshjE4EXeZzhFfvO1qz8QVVb1VZdo=' 
WHERE 
  key_id = 'cfe48439361a56eafca15c74b97b02d675daf21f664d349edc82d099c68af7fe' 
  AND (
    token = 'KTLFJMnMuWmUWLDshjE4EXeZzhFfvO1qz8QVVb1VZdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037