UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uD3E8RFd3SKHvT7ddD75MoP+SLC7Ymb/L3cmFq9wQ+s=' 
WHERE 
  key_id = '99e683ad46dd3203779f8e52f8ba0539ac70e650b04d9e24a0c983b0417040c7' 
  AND (
    token = 'uD3E8RFd3SKHvT7ddD75MoP+SLC7Ymb/L3cmFq9wQ+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030