UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U2nKmavFgU+FIZjNda8+ZJjoSpP1pjwLhfh15dwNi48=' 
WHERE 
  key_id = 'e5bf58b61942de9f5acda90414772a3f5339721340b32ae74c94d7a5e770589e' 
  AND (
    token = 'U2nKmavFgU+FIZjNda8+ZJjoSpP1pjwLhfh15dwNi48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032