UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bLiZeGCiyycwO9/4vx/6nysIWXPbnFIYa4GttvrpRHc=' 
WHERE 
  key_id = 'd8f3045026334c166f5589d053a5d0917ad8aa6654161d005e777cd98a3e8b80' 
  AND (
    token = 'bLiZeGCiyycwO9/4vx/6nysIWXPbnFIYa4GttvrpRHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027