UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FkSBEPnisUJTZVoluPs0K/iEmsTFZtPriRVruhbZlHY=' 
WHERE 
  key_id = 'beb659cdf2c2c6d35426c4366022a72566877a145c6559a30a6a3686a5d53c4b' 
  AND (
    token = 'FkSBEPnisUJTZVoluPs0K/iEmsTFZtPriRVruhbZlHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054