UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VWtQMpPWDaWPaPHC3WFstd94p3fFvsQB4dNcQIzJeH4='
WHERE
key_id = 'c9f30a5c143fcd6de1330a37b0a5e1965384fff87b2a0530463e96d32ed76679'
AND (
token = 'VWtQMpPWDaWPaPHC3WFstd94p3fFvsQB4dNcQIzJeH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)