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

Query time 0.00018