UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jZXLPiQua2ARUM4+aso9lObGmEhlMZ2W9f4tmpvsbHk='
WHERE
key_id = 'a0447466b168e1f7a3c221fd7614a52799f1d76ffd8a9d1d41f5d14585f515e3'
AND (
token = 'jZXLPiQua2ARUM4+aso9lObGmEhlMZ2W9f4tmpvsbHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)