UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KuEzSlH+HD5k3uWk1xx0GYCyrnWeOgYyBHw+x0S99TY=' 
WHERE 
  key_id = 'ea1da31f6cdd3eb0cadd5e8e48cc5d67b4751c24d95a430609426082b8219d7c' 
  AND (
    token = 'KuEzSlH+HD5k3uWk1xx0GYCyrnWeOgYyBHw+x0S99TY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032