UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n9f0Jcay9yQr3YzWPT9abYDovqUsz63MS79FcbHdkdU='
WHERE
key_id = '59bb128f82621c50d6e16136fcfc93ef7904e1359b677e95183efb9f1f082d34'
AND (
token = 'n9f0Jcay9yQr3YzWPT9abYDovqUsz63MS79FcbHdkdU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)