UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k6mmVYct2LJ5XqLKGdIiuXQQO74SP7zBboE0ztWK5Xs='
WHERE
key_id = 'a640ff3ebe8ebcd54587712b3779d571b26acc2e175ca81bbba231d66eabe2ee'
AND (
token = 'k6mmVYct2LJ5XqLKGdIiuXQQO74SP7zBboE0ztWK5Xs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)