UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rX6D6DzKa/zBETNhzSo+mMdRXSNHxxFqjn7mPEPF+x0='
WHERE
key_id = '47dd02f415b1b4697676c91327057a2cf51199d5d1ea194df56ea0f88142afd8'
AND (
token = 'rX6D6DzKa/zBETNhzSo+mMdRXSNHxxFqjn7mPEPF+x0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)