UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P7wLe9jR/3lNPTKrxQ6H0m+HFbumoxIgo7YrDh7rGMc=' 
WHERE 
  key_id = '617034f1444ac487415cfdc2698836e4bed5f0bc0046e5b5997a4576eabe070e' 
  AND (
    token = 'P7wLe9jR/3lNPTKrxQ6H0m+HFbumoxIgo7YrDh7rGMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036