UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HtKo4B5jTR2Kp76CmWmgk9s6u1ZnAVjolfadgYR5eMo='
WHERE
key_id = '7d2f2123792df5b5fb3b5f596394394c8cf81262da50f0c753bc46f952fbd99b'
AND (
token = 'HtKo4B5jTR2Kp76CmWmgk9s6u1ZnAVjolfadgYR5eMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)