UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XmCDxjuaa35EMkX3NgPVbkeVbgwpm/wyF9ipMFPJlXU='
WHERE
key_id = 'eb3f59055ced582c1139c81085b11b5b643b1fa8c414a66979d3d220563beee4'
AND (
token = 'XmCDxjuaa35EMkX3NgPVbkeVbgwpm/wyF9ipMFPJlXU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)