UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TwvU3wFUZafB64xo99g3V+qkX43GX6jKuagLKvZqWhU=' 
WHERE 
  key_id = '98f13d453bca237d47505780658c5c2d4d66d0c33a5654f4393125bb1019f804' 
  AND (
    token = 'TwvU3wFUZafB64xo99g3V+qkX43GX6jKuagLKvZqWhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025