UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9vENlqvVPph/+6BDjJlhwZYg7LW4GckQ6R/Q5N/N5S8=' 
WHERE 
  key_id = '1ac338c6614dbf633500e302c4267e088e0172e8459f7e1fc2f3a0a6e4188438' 
  AND (
    token = '9vENlqvVPph/+6BDjJlhwZYg7LW4GckQ6R/Q5N/N5S8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028