UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9T7BYjqcy/jit4Dq7nTtnhSlOzzJEhyYR7VSeIx0ybE=' 
WHERE 
  key_id = 'baf34d366a7b0ce408b3fee6003788b6506cd64d51b52a372b32b01f1ed69a08' 
  AND (
    token = '9T7BYjqcy/jit4Dq7nTtnhSlOzzJEhyYR7VSeIx0ybE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065