UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L5hlBkzr25AQ0g4K0ctOiW2fLBnFc/GuhD1bUnyRr4w=' 
WHERE 
  key_id = '408b04e62f8eaa2362e96e58024b224121a1c4dda583b0e46e035db8ee9a3883' 
  AND (
    token = 'L5hlBkzr25AQ0g4K0ctOiW2fLBnFc/GuhD1bUnyRr4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047