UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D3Dpeo8R86V8OW+3SpY2X9nt+gFL0JV8GipRwctYEVA=' 
WHERE 
  key_id = '30ba40adc2c52f932fe58646c99ab07cb836c24e9f972c14c783715ca0bab8f0' 
  AND (
    token = 'D3Dpeo8R86V8OW+3SpY2X9nt+gFL0JV8GipRwctYEVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035