UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '09XsUUSha1vK0hNsbdCk2jiOycSSrb4PO/2JwVAbkDI=' 
WHERE 
  key_id = '40fc4ed917f8504f812b732074f1f98069034e42362068f012855dff8eb50309' 
  AND (
    token = '09XsUUSha1vK0hNsbdCk2jiOycSSrb4PO/2JwVAbkDI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028