UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I5b+BkgThgC5YppRbKYKEeD0Q//hPNUXod9+RMiJkXA=' 
WHERE 
  key_id = 'c6860372d55104507126dcbb3b65bfcb6dc797aecb9e4d67f1c8e7c94c04c2a1' 
  AND (
    token = 'I5b+BkgThgC5YppRbKYKEeD0Q//hPNUXod9+RMiJkXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078