UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M7i5Tnn9df27A6a4ouPiaiAflm3Z6LzIuh1gnpb3hr8='
WHERE
key_id = '857c7f93d41842b445625ae4152922aa11fe5ab654cac7d6ed16d2a106370bb8'
AND (
token = 'M7i5Tnn9df27A6a4ouPiaiAflm3Z6LzIuh1gnpb3hr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)