UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8rMGYEurFOW/fCNeQgDTHnbhlpwotvWix7X2/DI5EBI=' 
WHERE 
  key_id = '16586164efd4b119227f698801ea6f50c834dbaa7d60e3cac550b46122d6fb54' 
  AND (
    token = '8rMGYEurFOW/fCNeQgDTHnbhlpwotvWix7X2/DI5EBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026