UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S7dnRfXnIgXDfDb+gsUon0rFBjtu+Pf7Or7/JdYWNzE=' 
WHERE 
  key_id = '4fa97bb6889225fb0774f544199c380f2b646e9240e0fd52763b01618e215b6f' 
  AND (
    token = 'S7dnRfXnIgXDfDb+gsUon0rFBjtu+Pf7Or7/JdYWNzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018