UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GXt1UvzsB5t6YgHcGqQfT59RWf5UvL6hlf0SDLd9oqM=' 
WHERE 
  key_id = 'b86e2bbc05f6f6141e05895cdafd804f22082d1e5cd2663984c8d95176a97b52' 
  AND (
    token = 'GXt1UvzsB5t6YgHcGqQfT59RWf5UvL6hlf0SDLd9oqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025