UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QyfQ+WEUPQRuTYv2S0u0inQ9jA8Jt02kTaO/wjTmjnc=' 
WHERE 
  key_id = 'b5fb3c616854f3215e493d02234df4170dd9670f052bdb1deae935ddaaf4c8f1' 
  AND (
    token = 'QyfQ+WEUPQRuTYv2S0u0inQ9jA8Jt02kTaO/wjTmjnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00109