UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'snYg+3jFbXX9W3hN6dGVIX4pqnllkDDDx1tahWi04dM=' 
WHERE 
  key_id = '89b8888051e63d91c25f55b1f05cdf5550c6df25ee81bc489b2f84b0359987b7' 
  AND (
    token = 'snYg+3jFbXX9W3hN6dGVIX4pqnllkDDDx1tahWi04dM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017