UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C9CL4PSKeD7xK7e9eK7vDt3ERHCaV+4CbS+y6q38hJo=' 
WHERE 
  key_id = '30499932ea4ca0b42b8142be2091e309f986ccd6644aa60b288e57e8e00493b9' 
  AND (
    token = 'C9CL4PSKeD7xK7e9eK7vDt3ERHCaV+4CbS+y6q38hJo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038