UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a36xMa/LOBmdzzyJiss/5QEx2H4TbmwkV5bPM5v8qcA=' 
WHERE 
  key_id = '9704d25129794245267d84d7fbb6f6ced4d381dbb904c22df860f86eb61f0434' 
  AND (
    token = 'a36xMa/LOBmdzzyJiss/5QEx2H4TbmwkV5bPM5v8qcA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042