UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QGrrpoc67kWV7cyB/AnQtMOHHnX5v8LxAHELfFoks0U=' 
WHERE 
  key_id = '1e08638de563040a953abb2c09cbdc56f675d50a7e7b2cae03d7688b519b2c3e' 
  AND (
    token = 'QGrrpoc67kWV7cyB/AnQtMOHHnX5v8LxAHELfFoks0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037