UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oiHd16hB4SN+bMq9EbJYxH6KzeJjGZh9OsX7345SuB4='
WHERE
key_id = '54631f9a6ebdbdced1ddb518db4dfa7cfac5290516fcaca225767d6704735629'
AND (
token = 'oiHd16hB4SN+bMq9EbJYxH6KzeJjGZh9OsX7345SuB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)