UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xuJUp00YN3r661pgOiT7jY38jAJkNHdIREY83Q2aXD0='
WHERE
key_id = 'ccd8c5e0650233e256355d2b79d615658b9ba9a768cb336fa9f535dd264a58c7'
AND (
token = 'xuJUp00YN3r661pgOiT7jY38jAJkNHdIREY83Q2aXD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)