UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vsDDjwoY1S7RKsfK3vG6oBk+HyzKACdmte2KOkFIY0g='
WHERE
key_id = 'dde76544c9868f7ebe958a57ed2cb8e95675eed4305e2fda382925202d67a0de'
AND (
token = 'vsDDjwoY1S7RKsfK3vG6oBk+HyzKACdmte2KOkFIY0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)