UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Y6sITK2+xCT8e5v+K8RPrZQSyYTdSP3t6uIXbe61yI='
WHERE
key_id = 'f36f63ce254fc0d37852f153d89f79f2f7eefdda81eeb1122f7f0bd3f36ca689'
AND (
token = '9Y6sITK2+xCT8e5v+K8RPrZQSyYTdSP3t6uIXbe61yI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)