UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qPcBN4/DzNySu8RCTAjw+pEDDSkucnaW0qzcdM1FnM0='
WHERE
key_id = 'd36a6abebddc047abe35ed65e1846f6d8374a4e8bfe31006d1eebddd2004cc46'
AND (
token = 'qPcBN4/DzNySu8RCTAjw+pEDDSkucnaW0qzcdM1FnM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)