UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QOTO+oNAJzcTL09S+fLUWNVUE3W8AuN7of/g1HsDBMo='
WHERE
key_id = 'd4e5e6f670a375a38b7f632363ddee2e0209e844bc9d9ac898c3d027b07edb71'
AND (
token = 'QOTO+oNAJzcTL09S+fLUWNVUE3W8AuN7of/g1HsDBMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)