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