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