UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QRjrjnXMDxzvjQ6rYO2Bax4WA6pDMxgRFqQD+n1Fe0k='
WHERE
key_id = '9fa2960081d40e30e31b7774449d79f60b246336cfb495629799f124746b5288'
AND (
token = 'QRjrjnXMDxzvjQ6rYO2Bax4WA6pDMxgRFqQD+n1Fe0k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)