UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tsh6GSq5LK+wGIWvNGjTqLuHq0nREekrKd2/ti8WmF0=' 
WHERE 
  key_id = '9ba19b458d742045663b0b8c64fa32d3a85d86423a73fc3470d84196dfeeba6e' 
  AND (
    token = 'Tsh6GSq5LK+wGIWvNGjTqLuHq0nREekrKd2/ti8WmF0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032