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

Query time 0.00027