UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2pdZAaD/uEhD8fqpU+waYhVO/fooJQFRzdO3iXTwy0g='
WHERE
key_id = 'a314ba26052dce737605cdfe38df6a0fd1fc0a17b8e3ca275af451688e2074a2'
AND (
token = '2pdZAaD/uEhD8fqpU+waYhVO/fooJQFRzdO3iXTwy0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)