UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VztGMDtKcb125OQHVVqtq2UtXe1C02YuryzZyirlHAk='
WHERE
key_id = '52c9055162b09b2826546f5fb3ab4cb348105b4302a802a5bb2bfc8d082174be'
AND (
token = 'VztGMDtKcb125OQHVVqtq2UtXe1C02YuryzZyirlHAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)