UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZIOnXcCdCzVUA5THSKPLvSP45OVJq5J+lBhUeCBXJ+4='
WHERE
key_id = 'cf4a500b40146121819285788bf50e279184ed5d62f68f0b44d39a47d5e6a1db'
AND (
token = 'ZIOnXcCdCzVUA5THSKPLvSP45OVJq5J+lBhUeCBXJ+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)