UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd7yIAEhutG0Lnmi8KGeyhpNYBgO3+cATPMJ/lx/iv/0='
WHERE
key_id = '9f6a0eeee16e0792aa6ba51009046a1a338c87efe51a97f1dd9ed9d283e4ae46'
AND (
token = 'd7yIAEhutG0Lnmi8KGeyhpNYBgO3+cATPMJ/lx/iv/0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)