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

Query time 0.00026