UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N5oEkz1ObcT2j/qDpeV2zV5ObN7zR6gOCdw6jvebiUk='
WHERE
key_id = 'dbb6b1f611dd006e6db92e451dc5409feb9b5a18c50f4706b1098b834541885c'
AND (
token = 'N5oEkz1ObcT2j/qDpeV2zV5ObN7zR6gOCdw6jvebiUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)