UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZoleOxAaKbKyt8VxGEzmBd8KS1tuGTACZn2FRsFgUUA='
WHERE
key_id = 'beb216ca50e65bf2cfc4087a2c8eef6ffc68623327199fbb66734e653ec777a8'
AND (
token = 'ZoleOxAaKbKyt8VxGEzmBd8KS1tuGTACZn2FRsFgUUA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)