UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g+S+7x6D4FR9F/oplnvdl7r56dmUBrGgJHi83/IYkWg='
WHERE
key_id = '3ff67a8e69e42f29d47e25988d48fc19b484acaae544e262b667963d9023d50f'
AND (
token = 'g+S+7x6D4FR9F/oplnvdl7r56dmUBrGgJHi83/IYkWg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)