UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xzsqk26ugbgnNHEo0HWDvwHMlPwTFVpFx7TzbUls8Ts=' 
WHERE 
  key_id = '3d52c9a99789dafd801c33351721e95f4097afd6a8c576df36c423eef9280430' 
  AND (
    token = 'xzsqk26ugbgnNHEo0HWDvwHMlPwTFVpFx7TzbUls8Ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030