UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd057sLpmlUH47o8+Z3Q+50wPp5vGHxRkgdUTbrfa76o=' 
WHERE 
  key_id = '77a78af03e443f5c86abc123f92f8122adf4fdf378c86fc0ddf7ce376cda6928' 
  AND (
    token = 'd057sLpmlUH47o8+Z3Q+50wPp5vGHxRkgdUTbrfa76o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040