UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5t17Ae7Mb1tAEu417ti1VAvwT/ChR8ygW20Odr8I6HY=' 
WHERE 
  key_id = 'be9a9ac2a1dcafd55a4e666e3039c38312b59e2fe2928ea74b5a99a3be886484' 
  AND (
    token = '5t17Ae7Mb1tAEu417ti1VAvwT/ChR8ygW20Odr8I6HY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022