UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4T8SMhRckjocxeFoK4yLJ8AZwEuJDthZj9Fd+wzK6dw='
WHERE
key_id = '094dcdc3ad18ffed60efea8ace72cccccf2f97b24f2083d8970989da5809825a'
AND (
token = '4T8SMhRckjocxeFoK4yLJ8AZwEuJDthZj9Fd+wzK6dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)