UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tsc/ZG0nOtyUTM0VaKHA7vkydRJ+MiD9m6bOGNH2Eco=' 
WHERE 
  key_id = '98386e0df103e87f35bab4e310cb0c667cc33106dd7fa982b7dbd79c32ac4bab' 
  AND (
    token = 'tsc/ZG0nOtyUTM0VaKHA7vkydRJ+MiD9m6bOGNH2Eco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040