UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2N6hJOpKKPbKJ+9FRUPdNAxCnvTWdt9FbOjeMnhmuMk='
WHERE
key_id = '07c27419f6ae46cb7032065cbce15c52ecaec15430f48509240cb54642b9331a'
AND (
token = '2N6hJOpKKPbKJ+9FRUPdNAxCnvTWdt9FbOjeMnhmuMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)