UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pR8i/8vTI5UMHb/p+1gdfvQut1RcnAECuMj5RlOPMJQ=' 
WHERE 
  key_id = '8526f90bdac03caf887e17c35633d3d8a301c9159658fbff1e1476a8b7ad1f8d' 
  AND (
    token = 'pR8i/8vTI5UMHb/p+1gdfvQut1RcnAECuMj5RlOPMJQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042