UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tem0bxWgQgaN0A+HuvgI3uozoFl4+dkuSEF/+Ljokx4='
WHERE
key_id = '2efef5dd735ac1729bbf46fd7a19701889e8a24555e1112c88c035b4997533d8'
AND (
token = 'tem0bxWgQgaN0A+HuvgI3uozoFl4+dkuSEF/+Ljokx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)