UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O2nXiudgsHBINugyJbRpU/quT3n+s/318nJ1F955xSE=' 
WHERE 
  key_id = '954169aaf0a291c4f679b24d043044d045e98247eb4c628cd1ccf8ffb7d43720' 
  AND (
    token = 'O2nXiudgsHBINugyJbRpU/quT3n+s/318nJ1F955xSE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032