UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rowfMgxlYhzQujEDJWh+qpzerq5UPsnNvqYBTscNru0=' 
WHERE 
  key_id = '9d92ecba91234dc9073df5e9c9454d09ccb2b1c94fa54a41157dfcb0bdd46f39' 
  AND (
    token = 'rowfMgxlYhzQujEDJWh+qpzerq5UPsnNvqYBTscNru0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027