UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XtUZIiBC5gvoOl+6O1g476tT9l40jqYeGoDlJFJRF2A='
WHERE
key_id = 'cd2d2991c310e21f3168846be468c7219454f2eecb43d26739c9737ee8031812'
AND (
token = 'XtUZIiBC5gvoOl+6O1g476tT9l40jqYeGoDlJFJRF2A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)